﻿using PECommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BattleServer.Service
{
    /// <summary>
    /// 战斗进程定时器
    /// </summary>
    public class BattleTimer : ILogic
    {
        TickTimer mTickTimer;
        public void Awake()
        {
            mTickTimer = new TickTimer(0, false)
            {
                LogFunc = this.Log,
                WarnFunc = this.Warn,
                ErrorFunc = this.Error,
            };
       
         
        }

        public void Destory()
        {
          mTickTimer.Reset();
        }

        public void Update()
        {
            mTickTimer.UpdateTask();
        }

        public int AddTask(uint delay,Action<int> taskCB,Action<int> cancelCB = null,int count = 1)
        {
          return mTickTimer.AddTask(delay,taskCB,cancelCB,count);
        }
        public bool DeleteTask(int tid)
        {
            return mTickTimer.DeleteTask(tid);
        }
    }
}
